#!/usr/bin/Rscript
usrName = Sys.getenv("USER")
if (usrName =='kacper'){
  path<- '/home/kacper/dev/timeser/time-series-pred/src'
}else{
  if (usrName =='mateusz')
    path<- '/home/mateusz/workspace/TS1/time-series-pred/src'
}
if(usrName =='kc262414'){
  path <-"/home/students/mismap/k/kc262414/studia/szeregi/time-series-pred/src"
}

setwd(path)

if(!exists('ownPredDifferentTrans', mode="function")) source("spaceSearch.R")


runTest <-function(ts,arMethods,ArOrders,ArSmoothTable, lookBack){
  rzf1 <- runARsmooth(ts,arMethods,ArOrders,ArSmoothTable,lookBack)
  print(printRes(rzf1))
  rzf2 <- runAR(ts,arMethods,ArOrders,lookBack)
  print(printRes(rzf2))
  rzf3 <- runMA(ts)
  print('=========================================')
  print(printRes(rzf1))
  print(printRes(rzf2))
  print(printRes(rzf3))
  print('=========================================')
}




## FOR ZF
arMethods<-c('ols')
ArOrders<-c(1,2,3,4)
ArSmoothTable <-c(1,2,3,4)
lookBack<-c(10000)

runTest(zf,arMethods,ArOrders,ArSmoothTable,lookBack)

# FOR GOOG

arMethods<-c('ols')
ArOrders<-c(1,2,3,4,5,6,7)
ArSmoothTable <-c(1,2,3,4,5)
lookBack<-c(100,150,200,250,500)

runTest(google,arMethods,ArOrders,ArSmoothTable,lookBack)


# FOR CL

arMethods<-c('ols')
ArOrders<-c(6)
ArSmoothTable <-c(1)
lookBack<-c(91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109)

runTest(cl,arMethods,ArOrders,ArSmoothTable,lookBack)


# FOR EUR
rzf3 <- runMA(euro)
print('=========================================')
print(printRes(rzf3))
print('=========================================')

fc <-ownPredict(euro, MartingalePredict,100, logReturnTransform, logReturnDeTransform)
print(fc$aafe)
fc <-ownPredict(euro, MartingalePredict,10, diffTransform, diffDeTransform)
print(fc$aafe)
fc <-ownPredict(euro, MartingalePredict,1, logTransform, logDeTransform)
print(fc$aafe)
fc <-ownPredict(euro, MartingalePredict,10, logDiffTransform, logDiffDeTransform)
print(fc$aafe)
